package priv.yiyuan.example.design.visitor;

import priv.yiyuan.example.design.visitor.policy.CarInsurance;
import priv.yiyuan.example.design.visitor.policy.HealthInsurance;

/**
 * 风险评估访问者
 *
 * @author YiYuan
 * @data 2025/7/30
 * @apoNote
 */
public class RiskAssessmentVisitor implements PolicyVisitor {

    @Override
    public void visit(CarInsurance policy) {
        int riskScore = policy.getYear() > 2025 ? 3 : 5;
        System.out.println("Car Insurance Risk: " + riskScore + "/10");
    }

    @Override
    public void visit(HealthInsurance policy) {
        int riskScore = policy.isHasPreExistingCondition() ? 8 : 2 + policy.getAge() / 30;
        System.out.println("Health Insurance Risk: " + riskScore + "/10");
    }
}
